package cn.wangkai.peanut.commons.beanutils;

import java.util.Set;

import org.apache.commons.beanutils.Converter;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class SetConverter implements Converter {

	private static final Log log = LogFactory.getLog(SetConverter.class);
	
	public SetConverter() {
	}
	
	@SuppressWarnings("rawtypes")
	public Object convert(Class type, Object value) {
		log.debug("type="+type+"||value="+value);
		if(value==null||StringUtils.isBlank(value.toString())) {
			return null;
		}

		if(value instanceof Set) {
			return value;
		}
		
		return null;
	}
	
	public static void main(String[] args) {

	}

}
